package model

import (
	"gorm.io/gorm"
	"ppa/init/mysql"
)

type CategoriesNft struct {
	ID uint `json:"id" form:"categories_nft_id" gorm:"primaryKey;autoIncrement;not null"`
	CategoriesId uint `json:"categories_id"  form:"categories_id" `
	NftId uint `json:"nft_id"  form:"nft_id" `
	Categories Categories  `json:"categories" gorm:"ForeignKey:CategoriesId;AssociationForeignKey:CategoriesId"`
}


func SetCategoriesNft(categoriesNftList []CategoriesNft,tx *gorm.DB) ([]CategoriesNft, error)  {
	db := mysql.SqlDB
	if tx != nil {
		db = tx
	}
	err := db.Create(&categoriesNftList).Error
	if err != nil {
		return nil, err
	}
	return categoriesNftList, nil
}
